﻿using System;
using AchSegítő.extensions;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AchSegítő.Tests
{
    [TestClass]
    public class StringExtensionTests
    {
        [TestMethod]
        public void HandleEmpty()
        {
            Assert.AreEqual("    ", string.Empty.TrimAndPadLeft(4));
        }

        [TestMethod]
        public void HandleNull()
        { 
            Assert.AreEqual("      ", ((string) null).TrimAndPadLeft(6));
        }

        [TestMethod]
        public void TruncateLong()
        {
            Assert.AreEqual("ABCD", ((string)"ABCDEFGHIJKLMNOPQRSTUVWXYZ").TrimAndPadLeft(4,'0'));
        }

        [TestMethod]
        public void PadLeft()
        {
            Assert.AreEqual("ABC   ",((string)"ABC").TrimAndPadRight(6));
        }

        [TestMethod]
        public void PadRight()
        {
            Assert.AreEqual("   ABC",((string)"ABC").TrimAndPadLeft(6,' '));
        }

    }
}
